<template>
    <div>
        <myback></myback>
    
    <div >
    <a-input ref="usernameInput" v-model="username" placeholder="用户">
      <a-icon slot="prefix" type="user" />
    </a-input>
    <br />
    <br />
    <div class="com">
    <a-input v-model="password" prefix="输入密码"  /></div>
  </div><br />
  <a-button @click="submit">登录</a-button>
    </div>
</template>

<script>
import axios from 'axios'
import myback from './myback'

export default {
    data() {
        return {
            username:'',
            password:''

        }
    },
    components:{
        'myback':myback
       




  },
    methods: {
      submit(){
      if(this.username == ''){
        this.$toast('请填写用户名');
        return false;
      }
      if(this.password == ''){
        this.$toast('请填写密码');
        return false; 
      }
      
      axios.post('http://127.0.0.1:8000/myapp/logins/',{username:this.username,password:this.password}).then(res=>{
       
          alert(res.data.msg)
        
      })
  
    }
  },
    
    created() {

    }
}
</script>

<style>
com{
    text-align:center;

}

</style>
